<!--合伙人-单独设置比例记录-->
<template>
  <div class="bg bg1">
    
    <div class="cell">
      <text class="font22 text3 all">{{T('好友UID')}}</text>
      <text class="font22 text3 all">{{T('调整后比例')}}</text>
      <text class="font22 text3 width130 tRight">{{T('调整时间')}}</text>
    </div>

    <!--邀请记录列表-->
    <list class="all" :loadmoreoffset="50" @loadmore="httpsProportionListLoad">

      <cell v-for="(item, index) in datas" v-bind:key="index">
        <div v-if="item.uuid">
          <div class="cell">
            <text class="font22 text3 all">{{item.uuid}}</text>
            <text class="font22 text3 all">{{item.proportion+'%'}}</text>
            <text class="font22 text3 width130 tRight">{{item.createTime}}</text>
          </div>
          <div class="line line1"></div>
        </div>

        <div v-else class="genduo">
          <text class="font22 text3">{{T('没有更多数据')}}</text>
        </div>
      </cell>


    </list>
    <!--邀请记录列表-->

  </div>
</template>

<style src="@/_css/style.css" ></style>
<style scoped>
.bg {
  padding-left: 40px;
  padding-right: 40px;
}
/********************** 记录*/
.cell{
  flex-direction: row;
  align-items: center;
  padding-top: 20px;
  padding-bottom: 20px;
}
.line {
  height:1px;
}
.genduo{
  flex-direction: row;
  justify-content: center;
  align-items: center;
  height: 100px;
}
</style>

<script>
import jmodal from "@/_js/modal";
import jhttps from "@/_js/https";
import jtime from "@/_js/time";

const weexFunction = weex.requireModule("WeexFunction");

import I18N from "@/_i18n/i18n";
var T = I18N.t;
weexFunction.setTitle(T("单独设置比例"));

export default {
  
  data() {
    return {
      T:T,

      datas:[], //数据源
      pageNo:0, //当前页面
      
      onLoad:false, //true加载中
      max:false, //true无跟多数据
    };
  },

  //即将显示
  mounted() {
    this.httpsProportionListLoad();
  },

  methods: {

    initData(datas) {
      for (let index = 0; index < datas.length; index++) {
        var data = datas[index];
        data.createTime = jtime.getTime(data.createTime, 'y/M/d');
        data.proportion = jmath.cheng(data.proportion, '100');
      }
      return datas;
    },
    
    /*************** https*/
    //设置分配比例记录-加载
    httpsProportionListLoad(){

      if(this.onLoad) return;
      if(this.max) return;
      this.onLoad = true;
      var param = {'pageNo':this.pageNo+1};
      jhttps.post("partner/queryProportionRecodeList",param,true,(data)=>{
          this.onLoad = false;

          if(data.status == 200){
            this.pageNo++;
            var datas = this.initData(data.data);
            this.datas.push(...datas);
             if(datas.length < 20) {
              this.max = true;
              this.datas.push({});
            }
          }else{
            jmodal.toast(data.msg);
          }
      });
    },
  }
};
</script>
